package cz.muni.fi.pa165.languageschool.dto;

import cz.muni.fi.pa165.languageschool.utils.Authority;
import java.util.ArrayList;
import java.util.List;

/**
 * Student Data Access Object
 *
 * @author Marketa Trachtova (255498) marketa.tr(at)gmail.com, Michal Fučík
 * (395624) michal.fuca.fucik(at)gmail.com
 */
public class StudentTO {

    private Long id;
    private String firstName;
    private String lastName;
    private List<LectureTO> enrolledLectures = new ArrayList<>();
    private String username;
    private String password;
    private boolean enabled;
    private Authority authority;

    public StudentTO() {
    }

    public StudentTO(Long id,
            String firstName,
            String lastName,
            String username,
            String password,
            Authority authority,
            boolean enabled,
            List<LectureTO> lec) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.username = username;
        this.password = password;
        this.authority = authority;
        this.enabled = enabled;
        this.enrolledLectures = lec;
    }

    public List<LectureTO> getEnrolledLectures() {
        return enrolledLectures;
    }

    public void setEnrolledLectures(List<LectureTO> enrolledLectures) {
        this.enrolledLectures = enrolledLectures;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public Authority getAuthority() {
        return authority;
    }

    public void setAuthority(Authority authority) {
        this.authority = authority;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final StudentTO other = (StudentTO) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getId() + " " + getFirstName() + " " + getLastName();
    }
}
